<?php
class Response
{
    public static function SetHeader($name, $value)
    {
        header("$name: $value", true);
    }

    public static function SetStatusCode( $code, $text = null )
    {
        if ( empty($code) )
        {
            return;
        }

        header("Status: $code $text", true);
        header("HTTP/1.0 $code $text", true);
    }

    /**
     * Sets a cookie.
     *
     * @param string $name      Name for the cookie
     * @param string $value     Value for the cookie
     * @param int    $expire    A Unix timestamp when cookie expires
     * @param bool   $raw       True to not urlencode value
     * @param string $path      Path
     * @param string $domain    Domain name
     * @param bool   $secure    If secure
     * @param bool   $httponly  If uses only HTTP
     *
     * @return bool True if successfully set
     */
    public static function SetCookie($name, $value, $expire = 0, $raw = true,
            $path = '/', $domain = '', $secure = false, $httponly = false)
    {
        if ($raw)
        {
            return setrawcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
        }

        return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
    }
}
?>
